package cloud.alibaba.consumer.config;

import feign.Contract;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @auther xfanonymous
 * @create 2024-01-01 15:42
 *
 * 1. 通过RestTemplate+LoadBalancer实现服务访问
 * 2. @LoadBalanced 赋予RestTemplate负载均衡的能力
 */
@Configuration
public class RestTemplateConfig
{
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate()
    {
        return new RestTemplate();
    }
}
